package com.flitsneak.designpatterns.behavioralpatterns.command;

import java.util.ArrayList;
import java.util.List;

/**
 * @author flitsneak
 * @email flitsneak@gmail.com
 * @date 2022/7/18 15:29
 * @description
 */
public class MissDuan {

    private List<Demand> demands = new ArrayList<>(8);

    public void addDemand(Demand demand) {
        demands.add(demand);
    }

    public void stateNeed(Demand demand) {
        demand.satisfyNeeds();
    }

    public void stateNeeds() {
        demands.forEach(d -> d.satisfyNeeds());
        demands.clear();
    }
}
